using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Production
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("ProductionOrder")]
    [Route("api/basic-archives/production-order")]
    public partial class ProductionOrderController : BasicArchivesController, IProductionOrderAppService
    {
        protected IProductionOrderAppService ProductionOrderAppService => LazyServiceProvider.LazyGetRequiredService<IProductionOrderAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<ProductionOrderDto> GetAsync(Guid id)
        {
            return ProductionOrderAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("child/{id}")]
        public Task<ProductionOrderPreparationDto> GetChildAsync(Guid id)
        {
            return ProductionOrderAppService.GetChildAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<ProductionOrderDto> FindAsync(string filter)
        {
            return ProductionOrderAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<ProductionOrderDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return ProductionOrderAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<ProductionOrderDto>> GetListAsync(FilterRequestDto input)
        {
            return ProductionOrderAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<ProductionOrderDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return ProductionOrderAppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("query-children")]
        public Task<PagedResultDto<ProductionOrderPreparationDto>> QueryChildrenAsync(FilterGroupRequestDto input)
        {
            return ProductionOrderAppService.QueryChildrenAsync(input);
        }

        [HttpPost]
        public Task<ProductionOrderDto> CreateAsync(ProductionOrderCreateDto input)
        {
            return ProductionOrderAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<ProductionOrderDto> UpdateAsync(Guid id, ProductionOrderUpdateDto input)
        {
            return ProductionOrderAppService.UpdateAsync(id, input);
        }

        [HttpPost]
        [Route("submit")]
        public Task<ProductionOrderDto> SubmitAsync(Guid id)
        {
            return ProductionOrderAppService.SubmitAsync(id);
        }

        [HttpPost]
        [Route("approve")]
        public Task<ProductionOrderDto> ApproveAsync(Guid id)
        {
            return ProductionOrderAppService.ApproveAsync(id);
        }

        [HttpPost]
        [Route("unapprove")]
        public Task<ProductionOrderDto> UnApproveAsync(Guid id)
        {
            return ProductionOrderAppService.UnApproveAsync(id);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return ProductionOrderAppService.DeleteAsync(id);
        }

        [HttpPost]
        [Route("batch-create")]
        public Task<List<ProductionOrderDto>> BatchCreateAsync(List<ProductionOrderCreateDto> inputs, bool useBulk = false)
        {
            return ProductionOrderAppService.BatchCreateAsync(inputs, useBulk);
        }

        [HttpPut]
        [Route("batch-update")]
        public Task<List<ProductionOrderDto>> BatchUpdateAsync(List<ProductionOrderBatchUpdateDto> inputs, bool useBulk = false)
        {
            return ProductionOrderAppService.BatchUpdateAsync(inputs, useBulk);
        }

        [HttpPost]
        [Route("batch-delete")]
        public Task BatchDeleteAsync(List<Guid> ids, bool useBulk = false)
        {
            return ProductionOrderAppService.BatchDeleteAsync(ids, useBulk);
        }
    }
} 